<!--
Copyright (c) 2019-2026, Hossein Moein
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
  notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
  notice, this list of conditions and the following disclaimer in the
  documentation and/or other materials provided with the distribution.
* Neither the name of Hossein Moein and/or the DataFrame nor the
  names of its contributors may be used to endorse or promote products
  derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL Hossein Moein BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<!DOCTYPE html>
<html>
<body>
  <table align="center" border="1">

    <tr bgcolor="lightblue">
        <th>Signature</th> <th>Description</th> <th>Parameters</th>

    </tr>
    <tr bgcolor="lightgrey">
      <td bgcolor="maroon"> <font color="white">
        <PRE><B>
template&lt;typename ... Ts&gt;
DataFrame
get_data_by_loc(Index2D&lt;long&gt; range) const;
        </B></PRE></font>
      </td>
      <td>
        It returns a DataFrame (including the index and data columns) containing the data from location begin to location end.<BR>
        This function supports Python-like negative indexing. That is why the range type is long.
      </td>
      <td>
        <B>Ts</B>: The list of types for all columns. A type should be specified only once.<BR>
        <B>range</B>: The begin and end iterators for data
      </td>
    </tr>

    <tr bgcolor="lightgrey">
      <td bgcolor="maroon"> <font color="white">
        <PRE><B>
template&lt;typename ... Ts&gt;
DataFrame<
get_data_by_loc(const std::vector&lt;long&gt; &amp;locations) const;
        </B></PRE></font>
      </td>
      <td>
        It returns a DataFrame (including the index and data columns) containing the data from locations, specified in locations vector. This function supports Python-like negative indexing. That is why the locations vector type is long.<BR>
        <B>NOTE</b>: The negative indexing is relative to the "index" column, which may not be the size as all other column.<BR>
        The returned DataFrame is in the same order as locations parameter
      </td>
      <td>
        <B>Ts</B>: The list of types for all columns. A type should be specified only once.<BR>
        <B>locations</B>: List of indices into the index column to copy data
      </td>
    </tr>

    <tr bgcolor="lightgrey">
      <td bgcolor="maroon"> <font color="white">
        <PRE><B>
template&lt;typename ... Ts&gt;
DataFrameView&lt;I&gt;
get_view_by_loc(Index2D&lt;long&gt; range);
        </B></PRE></font>
      </td>
      <td>
        It behaves like get_data_by_loc(), but it returns a DataFrameView.<BR>
        A view is a DataFrame that is a reference to the original DataFrame.<BR>
        So if you modify anything in the view the original DataFrame will also be modified.<BR>
        <B>NOTE</B>: There are certain operations that you cannot do with a view. For example, you cannot add/delete columns, etc.<BR>
        <B>NOTE</B>: Views could not be const, becuase you can change original data through views.<BR>
      </td>
      <td>
        <B>Ts</B>: The list of types for all columns. A type should be specified only once.<BR>
        <B>range</B>: The begin and end iterators for data
      </td>
    </tr>

    <tr bgcolor="lightgrey">
      <td bgcolor="maroon"> <font color="white">
        <PRE><B>
template&lt;typename ... Ts&gt;
DataFramePtrView&lt;I&gt;
get_view_by_loc(const std::vector&lt;long&gt; &amp;locations);
        </B></PRE></font>
      </td>
      <td>
        It behaves like get_data_by_loc(locations), but it returns a DataFramePtrView.<BR>
        A view is a DataFrame that is a reference to the original DataFrame. So if you modify anything in the view the original DataFrame will also be modified.<BR>
        <B>NOTE</B>: There are certain operations that you cannot do with a view. For example, you cannot add/delete columns, etc.<BR>
        <B>NOTE</B>: Views could not be const, becuase you can change original data through views.<BR>
      </td>
      <td>
        <B>Ts</B>: The list of types for all columns. A type should be specified only once.<BR>
        <B>locations</B>: List of indices into the index column to copy data
      </td>
    </tr>

    <tr bgcolor="lightgrey">
      <td bgcolor="maroon"> <font color="white">
        <PRE><B>
template&lt;typename ... Ts&gt;
DataFrameConstView&lt;I&gt;
get_view_by_loc(Index2D&lt;long&gt; range) const;
        </B></PRE></font>
      </td>
      <td>
          Same as above view, but it returns a <I>const</I> view. You can not change data in const views. But if the data is changed in the original DataFrame or through another view, it is refelcted in the const view.       
      </td>
      <td>
        <B>Ts</B>: The list of types for all columns. A type should be specified only once.<BR>
        <B>range</B>: The begin and end iterators for data
      </td>
    </tr>

    <tr bgcolor="lightgrey">
      <td bgcolor="maroon"> <font color="white">
        <PRE><B>
template&lt;typename ... Ts&gt;
DataFrameConstPtrView&lt;I&gt;
get_view_by_loc(const std::vector&lt;long&gt; &amp;locations) const;
        </B></PRE></font>
      </td>
      <td>
          Same as above view, but it returns a <I>const</I> view. You can not change data in const views. But if the data is changed in the original DataFrame or through another view, it is refelcted in the const view.       
      </td>
      <td>
        <B>Ts</B>: The list of types for all columns. A type should be specified only once.<BR>
        <B>locations</B>: List of indices into the index column to copy data
      </td>
    </tr>

  </table>

 <!-- HTML generated using hilite.me --><div style="background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;"><pre style="margin: 0; line-height: 125%"><span style="color: #008800; font-weight: bold">static</span> <span style="color: #333399; font-weight: bold">void</span> <span style="color: #0066BB; font-weight: bold">test_get_data_by_loc_slicing</span>()  {

    std<span style="color: #333333">::</span>cout <span style="color: #333333">&lt;&lt;</span> <span style="background-color: #fff0f0">&quot;</span><span style="color: #666666; font-weight: bold; background-color: #fff0f0">\n</span><span style="background-color: #fff0f0">Testing get_data_by_loc()/slicing ...&quot;</span> <span style="color: #333333">&lt;&lt;</span> std<span style="color: #333333">::</span>endl;

    std<span style="color: #333333">::</span>vector<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">unsigned</span> <span style="color: #333399; font-weight: bold">long</span><span style="color: #333333">&gt;</span>  idx <span style="color: #333333">=</span> { <span style="color: #0000DD; font-weight: bold">123450</span>, <span style="color: #0000DD; font-weight: bold">123451</span>, <span style="color: #0000DD; font-weight: bold">123452</span>, <span style="color: #0000DD; font-weight: bold">123450</span>, <span style="color: #0000DD; font-weight: bold">123455</span>, <span style="color: #0000DD; font-weight: bold">123450</span>, <span style="color: #0000DD; font-weight: bold">123449</span> };
    std<span style="color: #333333">::</span>vector<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span> d1 <span style="color: #333333">=</span> { <span style="color: #0000DD; font-weight: bold">1</span>, <span style="color: #0000DD; font-weight: bold">2</span>, <span style="color: #0000DD; font-weight: bold">3</span>, <span style="color: #0000DD; font-weight: bold">4</span>, <span style="color: #0000DD; font-weight: bold">5</span>, <span style="color: #0000DD; font-weight: bold">6</span>, <span style="color: #0000DD; font-weight: bold">7</span> };
    std<span style="color: #333333">::</span>vector<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span> d2 <span style="color: #333333">=</span> { <span style="color: #0000DD; font-weight: bold">8</span>, <span style="color: #0000DD; font-weight: bold">9</span>, <span style="color: #0000DD; font-weight: bold">10</span>, <span style="color: #0000DD; font-weight: bold">11</span>, <span style="color: #0000DD; font-weight: bold">12</span>, <span style="color: #0000DD; font-weight: bold">13</span>, <span style="color: #0000DD; font-weight: bold">14</span> };
    std<span style="color: #333333">::</span>vector<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span> d3 <span style="color: #333333">=</span> { <span style="color: #0000DD; font-weight: bold">15</span>, <span style="color: #0000DD; font-weight: bold">16</span>, <span style="color: #0000DD; font-weight: bold">17</span>, <span style="color: #0000DD; font-weight: bold">18</span>, <span style="color: #0000DD; font-weight: bold">19</span>, <span style="color: #0000DD; font-weight: bold">20</span>, <span style="color: #0000DD; font-weight: bold">21</span> };
    std<span style="color: #333333">::</span>vector<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span> d4 <span style="color: #333333">=</span> { <span style="color: #0000DD; font-weight: bold">22</span>, <span style="color: #0000DD; font-weight: bold">23</span>, <span style="color: #0000DD; font-weight: bold">24</span>, <span style="color: #0000DD; font-weight: bold">25</span> };
    MyDataFrame         df;

    df.load_data(std<span style="color: #333333">::</span>move(idx),
                 std<span style="color: #333333">::</span>make_pair(<span style="background-color: #fff0f0">&quot;col_1&quot;</span>, d1),
                 std<span style="color: #333333">::</span>make_pair(<span style="background-color: #fff0f0">&quot;col_2&quot;</span>, d2),
                 std<span style="color: #333333">::</span>make_pair(<span style="background-color: #fff0f0">&quot;col_3&quot;</span>, d3),
                 std<span style="color: #333333">::</span>make_pair(<span style="background-color: #fff0f0">&quot;col_4&quot;</span>, d4));

    MyDataFrame df2 <span style="color: #333333">=</span> df.get_data_by_loc<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(Index2D<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">long</span><span style="color: #333333">&gt;</span> { <span style="color: #0000DD; font-weight: bold">3</span>, <span style="color: #0000DD; font-weight: bold">6</span> });
    MyDataFrame df3 <span style="color: #333333">=</span> df.get_data_by_loc<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(Index2D<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">long</span><span style="color: #333333">&gt;</span> { <span style="color: #0000DD; font-weight: bold">0</span>, <span style="color: #0000DD; font-weight: bold">7</span> });
    MyDataFrame df4 <span style="color: #333333">=</span> df.get_data_by_loc<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(Index2D<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">long</span><span style="color: #333333">&gt;</span> { <span style="color: #333333">-</span><span style="color: #0000DD; font-weight: bold">4</span>, <span style="color: #333333">-</span><span style="color: #0000DD; font-weight: bold">1</span> });
    MyDataFrame df5 <span style="color: #333333">=</span> df.get_data_by_loc<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(Index2D<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">long</span><span style="color: #333333">&gt;</span> { <span style="color: #333333">-</span><span style="color: #0000DD; font-weight: bold">4</span>, <span style="color: #0000DD; font-weight: bold">6</span> });

    df.write<span style="color: #333333">&lt;</span>std<span style="color: #333333">::</span>ostream, <span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(std<span style="color: #333333">::</span>cout);
    df2.write<span style="color: #333333">&lt;</span>std<span style="color: #333333">::</span>ostream, <span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(std<span style="color: #333333">::</span>cout);
    df3.write<span style="color: #333333">&lt;</span>std<span style="color: #333333">::</span>ostream, <span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(std<span style="color: #333333">::</span>cout);
    df4.write<span style="color: #333333">&lt;</span>std<span style="color: #333333">::</span>ostream, <span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(std<span style="color: #333333">::</span>cout);
    df5.write<span style="color: #333333">&lt;</span>std<span style="color: #333333">::</span>ostream, <span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(std<span style="color: #333333">::</span>cout);

    try  {
        MyDataFrame df2 <span style="color: #333333">=</span> df.get_data_by_loc<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(Index2D<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">long</span><span style="color: #333333">&gt;</span> { <span style="color: #0000DD; font-weight: bold">3</span>, <span style="color: #0000DD; font-weight: bold">8</span> });
    }
    <span style="color: #008800; font-weight: bold">catch</span> (<span style="color: #008800; font-weight: bold">const</span> BadRange <span style="color: #333333">&amp;</span>ex)  {
        std<span style="color: #333333">::</span>cout <span style="color: #333333">&lt;&lt;</span> <span style="background-color: #fff0f0">&quot;Caught: &quot;</span> <span style="color: #333333">&lt;&lt;</span> ex.what() <span style="color: #333333">&lt;&lt;</span> std<span style="color: #333333">::</span>endl;
    }
    try  {
        MyDataFrame df2 <span style="color: #333333">=</span> df.get_data_by_loc<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(Index2D<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">long</span><span style="color: #333333">&gt;</span> { <span style="color: #333333">-</span><span style="color: #0000DD; font-weight: bold">8</span>, <span style="color: #333333">-</span><span style="color: #0000DD; font-weight: bold">1</span> });
    }
    <span style="color: #008800; font-weight: bold">catch</span> (<span style="color: #008800; font-weight: bold">const</span> BadRange <span style="color: #333333">&amp;</span>ex)  {
        std<span style="color: #333333">::</span>cout <span style="color: #333333">&lt;&lt;</span> <span style="background-color: #fff0f0">&quot;Caught: &quot;</span> <span style="color: #333333">&lt;&lt;</span> ex.what() <span style="color: #333333">&lt;&lt;</span> std<span style="color: #333333">::</span>endl;
    }
}

<span style="color: #888888">// -----------------------------------------------------------------------------</span>

<span style="color: #008800; font-weight: bold">static</span> <span style="color: #333399; font-weight: bold">void</span> <span style="color: #0066BB; font-weight: bold">test_get_view_by_loc</span>()  {

    std<span style="color: #333333">::</span>cout <span style="color: #333333">&lt;&lt;</span> <span style="background-color: #fff0f0">&quot;</span><span style="color: #666666; font-weight: bold; background-color: #fff0f0">\n</span><span style="background-color: #fff0f0">Testing get_view_by_loc() ...&quot;</span> <span style="color: #333333">&lt;&lt;</span> std<span style="color: #333333">::</span>endl;

    std<span style="color: #333333">::</span>vector<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">unsigned</span> <span style="color: #333399; font-weight: bold">long</span><span style="color: #333333">&gt;</span>  idx <span style="color: #333333">=</span> { <span style="color: #0000DD; font-weight: bold">123450</span>, <span style="color: #0000DD; font-weight: bold">123451</span>, <span style="color: #0000DD; font-weight: bold">123452</span>, <span style="color: #0000DD; font-weight: bold">123450</span>, <span style="color: #0000DD; font-weight: bold">123455</span>, <span style="color: #0000DD; font-weight: bold">123450</span>, <span style="color: #0000DD; font-weight: bold">123449</span> };
    std<span style="color: #333333">::</span>vector<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>         d1 <span style="color: #333333">=</span> { <span style="color: #0000DD; font-weight: bold">1</span>, <span style="color: #0000DD; font-weight: bold">2</span>, <span style="color: #0000DD; font-weight: bold">3</span>, <span style="color: #0000DD; font-weight: bold">4</span>, <span style="color: #0000DD; font-weight: bold">5</span>, <span style="color: #0000DD; font-weight: bold">6</span>, <span style="color: #0000DD; font-weight: bold">7</span> };
    std<span style="color: #333333">::</span>vector<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>         d2 <span style="color: #333333">=</span> { <span style="color: #0000DD; font-weight: bold">8</span>, <span style="color: #0000DD; font-weight: bold">9</span>, <span style="color: #0000DD; font-weight: bold">10</span>, <span style="color: #0000DD; font-weight: bold">11</span>, <span style="color: #0000DD; font-weight: bold">12</span>, <span style="color: #0000DD; font-weight: bold">13</span>, <span style="color: #0000DD; font-weight: bold">14</span> };
    std<span style="color: #333333">::</span>vector<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>         d3 <span style="color: #333333">=</span> { <span style="color: #0000DD; font-weight: bold">15</span>, <span style="color: #0000DD; font-weight: bold">16</span>, <span style="color: #0000DD; font-weight: bold">17</span>, <span style="color: #0000DD; font-weight: bold">18</span>, <span style="color: #0000DD; font-weight: bold">19</span>, <span style="color: #0000DD; font-weight: bold">20</span>, <span style="color: #0000DD; font-weight: bold">21</span> };
    std<span style="color: #333333">::</span>vector<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>         d4 <span style="color: #333333">=</span> { <span style="color: #0000DD; font-weight: bold">22</span>, <span style="color: #0000DD; font-weight: bold">23</span>, <span style="color: #0000DD; font-weight: bold">24</span>, <span style="color: #0000DD; font-weight: bold">25</span> };
    std<span style="color: #333333">::</span>vector<span style="color: #333333">&lt;</span>std<span style="color: #333333">::</span>string<span style="color: #333333">&gt;</span>    s1 <span style="color: #333333">=</span> { <span style="background-color: #fff0f0">&quot;11&quot;</span>, <span style="background-color: #fff0f0">&quot;22&quot;</span>, <span style="background-color: #fff0f0">&quot;33&quot;</span>, <span style="background-color: #fff0f0">&quot;xx&quot;</span>, <span style="background-color: #fff0f0">&quot;yy&quot;</span>, <span style="background-color: #fff0f0">&quot;gg&quot;</span>, <span style="background-color: #fff0f0">&quot;string&quot;</span> };
    MyDataFrame                 df;

    df.load_data(std<span style="color: #333333">::</span>move(idx),
                 std<span style="color: #333333">::</span>make_pair(<span style="background-color: #fff0f0">&quot;col_1&quot;</span>, d1),
                 std<span style="color: #333333">::</span>make_pair(<span style="background-color: #fff0f0">&quot;col_2&quot;</span>, d2),
                 std<span style="color: #333333">::</span>make_pair(<span style="background-color: #fff0f0">&quot;col_3&quot;</span>, d3),
                 std<span style="color: #333333">::</span>make_pair(<span style="background-color: #fff0f0">&quot;col_4&quot;</span>, d4),
                 std<span style="color: #333333">::</span>make_pair(<span style="background-color: #fff0f0">&quot;col_str&quot;</span>, s1));

    <span style="color: #008800; font-weight: bold">auto</span>  memory_use1 <span style="color: #333333">=</span> df.get_memory_usage<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(<span style="background-color: #fff0f0">&quot;col_3&quot;</span>);

    std<span style="color: #333333">::</span>cout <span style="color: #333333">&lt;&lt;</span> <span style="background-color: #fff0f0">&quot;DataFrame Memory Usage:</span><span style="color: #666666; font-weight: bold; background-color: #fff0f0">\n</span><span style="background-color: #fff0f0">&quot;</span> <span style="color: #333333">&lt;&lt;</span> memory_use1 <span style="color: #333333">&lt;&lt;</span> std<span style="color: #333333">::</span>endl;

    <span style="color: #008800; font-weight: bold">typedef</span> DataFrameView<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">unsigned</span> <span style="color: #333399; font-weight: bold">long</span><span style="color: #333333">&gt;</span> MyDataFrameView;
    <span style="color: #008800; font-weight: bold">typedef</span> DataFrameConstView<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">unsigned</span> <span style="color: #333399; font-weight: bold">long</span><span style="color: #333333">&gt;</span> MyDataFrameConstView;

    <span style="color: #008800; font-weight: bold">const</span> MyDataFrame   <span style="color: #333333">&amp;</span>const_df <span style="color: #333333">=</span> df;
    MyDataFrameView         dfv <span style="color: #333333">=</span>
        df.get_view_by_loc<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span>, std<span style="color: #333333">::</span>string<span style="color: #333333">&gt;</span>(Index2D<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">long</span><span style="color: #333333">&gt;</span> { <span style="color: #0000DD; font-weight: bold">3</span>, <span style="color: #0000DD; font-weight: bold">6</span> });
    MyDataFrameView         dfv2 <span style="color: #333333">=</span>
        df.get_view_by_loc<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span>, std<span style="color: #333333">::</span>string<span style="color: #333333">&gt;</span>(Index2D<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">long</span><span style="color: #333333">&gt;</span> { <span style="color: #333333">-</span><span style="color: #0000DD; font-weight: bold">5</span>, <span style="color: #333333">-</span><span style="color: #0000DD; font-weight: bold">1</span> });
    MyDataFrameConstView    dfcv <span style="color: #333333">=</span>
        const_df.get_view_by_loc<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span>, std<span style="color: #333333">::</span>string<span style="color: #333333">&gt;</span>(Index2D<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">long</span><span style="color: #333333">&gt;</span> { <span style="color: #0000DD; font-weight: bold">3</span>, <span style="color: #0000DD; font-weight: bold">6</span> });
    MyDataFrameConstView    dfcv2 <span style="color: #333333">=</span>
        const_df.get_view_by_loc<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span>, std<span style="color: #333333">::</span>string<span style="color: #333333">&gt;</span>(Index2D<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">long</span><span style="color: #333333">&gt;</span> { <span style="color: #333333">-</span><span style="color: #0000DD; font-weight: bold">5</span>, <span style="color: #333333">-</span><span style="color: #0000DD; font-weight: bold">1</span> });

    dfv.shrink_to_fit<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span>, std<span style="color: #333333">::</span>string<span style="color: #333333">&gt;</span>();
    dfv.write<span style="color: #333333">&lt;</span>std<span style="color: #333333">::</span>ostream, <span style="color: #333399; font-weight: bold">double</span>, std<span style="color: #333333">::</span>string<span style="color: #333333">&gt;</span>(std<span style="color: #333333">::</span>cout);
    dfv2.write<span style="color: #333333">&lt;</span>std<span style="color: #333333">::</span>ostream, <span style="color: #333399; font-weight: bold">double</span>, std<span style="color: #333333">::</span>string<span style="color: #333333">&gt;</span>(std<span style="color: #333333">::</span>cout);
    dfv.get_column<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(<span style="background-color: #fff0f0">&quot;col_3&quot;</span>)[<span style="color: #0000DD; font-weight: bold">0</span>] <span style="color: #333333">=</span> <span style="color: #6600EE; font-weight: bold">88.0</span>;
    assert(dfv.get_column<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(<span style="background-color: #fff0f0">&quot;col_3&quot;</span>)[<span style="color: #0000DD; font-weight: bold">0</span>] <span style="color: #333333">==</span> df.get_column<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(<span style="background-color: #fff0f0">&quot;col_3&quot;</span>)[<span style="color: #0000DD; font-weight: bold">3</span>]);
    assert(dfv.get_column<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(<span style="background-color: #fff0f0">&quot;col_3&quot;</span>)[<span style="color: #0000DD; font-weight: bold">0</span>] <span style="color: #333333">==</span> <span style="color: #6600EE; font-weight: bold">88.0</span>);
    assert(dfcv.get_column<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(<span style="background-color: #fff0f0">&quot;col_3&quot;</span>)[<span style="color: #0000DD; font-weight: bold">0</span>] <span style="color: #333333">==</span> df.get_column<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(<span style="background-color: #fff0f0">&quot;col_3&quot;</span>)[<span style="color: #0000DD; font-weight: bold">3</span>]);
    assert(dfcv.get_column<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(<span style="background-color: #fff0f0">&quot;col_3&quot;</span>)[<span style="color: #0000DD; font-weight: bold">0</span>] <span style="color: #333333">==</span> <span style="color: #6600EE; font-weight: bold">88.0</span>);

    <span style="color: #008800; font-weight: bold">auto</span>  memory_use2 <span style="color: #333333">=</span> dfv.get_memory_usage<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(<span style="background-color: #fff0f0">&quot;col_3&quot;</span>);

    std<span style="color: #333333">::</span>cout <span style="color: #333333">&lt;&lt;</span> <span style="background-color: #fff0f0">&quot;View Memory Usage:</span><span style="color: #666666; font-weight: bold; background-color: #fff0f0">\n</span><span style="background-color: #fff0f0">&quot;</span> <span style="color: #333333">&lt;&lt;</span> memory_use2 <span style="color: #333333">&lt;&lt;</span> std<span style="color: #333333">::</span>endl;
}

<span style="color: #888888">// -----------------------------------------------------------------------------</span>

<span style="color: #008800; font-weight: bold">static</span> <span style="color: #333399; font-weight: bold">void</span> <span style="color: #0066BB; font-weight: bold">test_get_data_by_loc_location</span>()  {

    std<span style="color: #333333">::</span>cout <span style="color: #333333">&lt;&lt;</span> <span style="background-color: #fff0f0">&quot;</span><span style="color: #666666; font-weight: bold; background-color: #fff0f0">\n</span><span style="background-color: #fff0f0">Testing get_data_by_loc(locations) ...&quot;</span> <span style="color: #333333">&lt;&lt;</span> std<span style="color: #333333">::</span>endl;

    std<span style="color: #333333">::</span>vector<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">unsigned</span> <span style="color: #333399; font-weight: bold">long</span><span style="color: #333333">&gt;</span>  idx <span style="color: #333333">=</span> { <span style="color: #0000DD; font-weight: bold">123450</span>, <span style="color: #0000DD; font-weight: bold">123451</span>, <span style="color: #0000DD; font-weight: bold">123452</span>, <span style="color: #0000DD; font-weight: bold">123450</span>, <span style="color: #0000DD; font-weight: bold">123455</span>, <span style="color: #0000DD; font-weight: bold">123450</span>, <span style="color: #0000DD; font-weight: bold">123449</span> };
    std<span style="color: #333333">::</span>vector<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span> d1 <span style="color: #333333">=</span> { <span style="color: #0000DD; font-weight: bold">1</span>, <span style="color: #0000DD; font-weight: bold">2</span>, <span style="color: #0000DD; font-weight: bold">3</span>, <span style="color: #0000DD; font-weight: bold">4</span>, <span style="color: #0000DD; font-weight: bold">5</span>, <span style="color: #0000DD; font-weight: bold">6</span>, <span style="color: #0000DD; font-weight: bold">7</span> };
    std<span style="color: #333333">::</span>vector<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span> d2 <span style="color: #333333">=</span> { <span style="color: #0000DD; font-weight: bold">8</span>, <span style="color: #0000DD; font-weight: bold">9</span>, <span style="color: #0000DD; font-weight: bold">10</span>, <span style="color: #0000DD; font-weight: bold">11</span>, <span style="color: #0000DD; font-weight: bold">12</span>, <span style="color: #0000DD; font-weight: bold">13</span>, <span style="color: #0000DD; font-weight: bold">14</span> };
    std<span style="color: #333333">::</span>vector<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span> d3 <span style="color: #333333">=</span> { <span style="color: #0000DD; font-weight: bold">15</span>, <span style="color: #0000DD; font-weight: bold">16</span>, <span style="color: #0000DD; font-weight: bold">17</span>, <span style="color: #0000DD; font-weight: bold">18</span>, <span style="color: #0000DD; font-weight: bold">19</span>, <span style="color: #0000DD; font-weight: bold">20</span>, <span style="color: #0000DD; font-weight: bold">21</span> };
    std<span style="color: #333333">::</span>vector<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span> d4 <span style="color: #333333">=</span> { <span style="color: #0000DD; font-weight: bold">22</span>, <span style="color: #0000DD; font-weight: bold">23</span>, <span style="color: #0000DD; font-weight: bold">24</span>, <span style="color: #0000DD; font-weight: bold">25</span> };
    MyDataFrame         df;

    df.load_data(std<span style="color: #333333">::</span>move(idx),
                 std<span style="color: #333333">::</span>make_pair(<span style="background-color: #fff0f0">&quot;col_1&quot;</span>, d1),
                 std<span style="color: #333333">::</span>make_pair(<span style="background-color: #fff0f0">&quot;col_2&quot;</span>, d2),
                 std<span style="color: #333333">::</span>make_pair(<span style="background-color: #fff0f0">&quot;col_3&quot;</span>, d3),
                 std<span style="color: #333333">::</span>make_pair(<span style="background-color: #fff0f0">&quot;col_4&quot;</span>, d4));

    MyDataFrame df2 <span style="color: #333333">=</span> df.get_data_by_loc<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(std<span style="color: #333333">::</span>vector<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">long</span><span style="color: #333333">&gt;</span> { <span style="color: #0000DD; font-weight: bold">3</span>, <span style="color: #0000DD; font-weight: bold">6</span> });
    MyDataFrame df3 <span style="color: #333333">=</span> df.get_data_by_loc<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(std<span style="color: #333333">::</span>vector<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">long</span><span style="color: #333333">&gt;</span> { <span style="color: #333333">-</span><span style="color: #0000DD; font-weight: bold">4</span>, <span style="color: #333333">-</span><span style="color: #0000DD; font-weight: bold">1</span> , <span style="color: #0000DD; font-weight: bold">5</span> });

    assert(df2.get_index().size() <span style="color: #333333">==</span> <span style="color: #0000DD; font-weight: bold">2</span>);
    assert(df2.get_column<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(<span style="background-color: #fff0f0">&quot;col_3&quot;</span>).size() <span style="color: #333333">==</span> <span style="color: #0000DD; font-weight: bold">2</span>);
    assert(df2.get_column<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(<span style="background-color: #fff0f0">&quot;col_2&quot;</span>).size() <span style="color: #333333">==</span> <span style="color: #0000DD; font-weight: bold">2</span>);
    assert(df2.get_index()[<span style="color: #0000DD; font-weight: bold">0</span>] <span style="color: #333333">==</span> <span style="color: #0000DD; font-weight: bold">123450</span>);
    assert(df2.get_index()[<span style="color: #0000DD; font-weight: bold">1</span>] <span style="color: #333333">==</span> <span style="color: #0000DD; font-weight: bold">123449</span>);
    assert(df2.get_column<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(<span style="background-color: #fff0f0">&quot;col_3&quot;</span>)[<span style="color: #0000DD; font-weight: bold">0</span>] <span style="color: #333333">==</span> <span style="color: #6600EE; font-weight: bold">18.0</span>);
    assert(df2.get_column<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(<span style="background-color: #fff0f0">&quot;col_2&quot;</span>)[<span style="color: #0000DD; font-weight: bold">1</span>] <span style="color: #333333">==</span> <span style="color: #6600EE; font-weight: bold">14.0</span>);
    assert(std<span style="color: #333333">::</span>isnan(df2.get_column<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(<span style="background-color: #fff0f0">&quot;col_4&quot;</span>)[<span style="color: #0000DD; font-weight: bold">1</span>]));

    assert(df3.get_index().size() <span style="color: #333333">==</span> <span style="color: #0000DD; font-weight: bold">3</span>);
    assert(df3.get_column<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(<span style="background-color: #fff0f0">&quot;col_3&quot;</span>).size() <span style="color: #333333">==</span> <span style="color: #0000DD; font-weight: bold">3</span>);
    assert(df3.get_column<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(<span style="background-color: #fff0f0">&quot;col_2&quot;</span>).size() <span style="color: #333333">==</span> <span style="color: #0000DD; font-weight: bold">3</span>);
    assert(df3.get_column<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(<span style="background-color: #fff0f0">&quot;col_1&quot;</span>).size() <span style="color: #333333">==</span> <span style="color: #0000DD; font-weight: bold">3</span>);
    assert(df3.get_index()[<span style="color: #0000DD; font-weight: bold">0</span>] <span style="color: #333333">==</span> <span style="color: #0000DD; font-weight: bold">123450</span>);
    assert(df3.get_index()[<span style="color: #0000DD; font-weight: bold">1</span>] <span style="color: #333333">==</span> <span style="color: #0000DD; font-weight: bold">123449</span>);
    assert(df3.get_index()[<span style="color: #0000DD; font-weight: bold">2</span>] <span style="color: #333333">==</span> <span style="color: #0000DD; font-weight: bold">123450</span>);
    assert(df3.get_column<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(<span style="background-color: #fff0f0">&quot;col_1&quot;</span>)[<span style="color: #0000DD; font-weight: bold">0</span>] <span style="color: #333333">==</span> <span style="color: #6600EE; font-weight: bold">4.0</span>);
    assert(df3.get_column<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(<span style="background-color: #fff0f0">&quot;col_2&quot;</span>)[<span style="color: #0000DD; font-weight: bold">2</span>] <span style="color: #333333">==</span> <span style="color: #6600EE; font-weight: bold">13.0</span>);
    assert(df3.get_column<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(<span style="background-color: #fff0f0">&quot;col_4&quot;</span>)[<span style="color: #0000DD; font-weight: bold">0</span>] <span style="color: #333333">==</span> <span style="color: #6600EE; font-weight: bold">25.0</span>);
    assert(std<span style="color: #333333">::</span>isnan(df3.get_column<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(<span style="background-color: #fff0f0">&quot;col_4&quot;</span>)[<span style="color: #0000DD; font-weight: bold">1</span>]));
    assert(std<span style="color: #333333">::</span>isnan(df3.get_column<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(<span style="background-color: #fff0f0">&quot;col_4&quot;</span>)[<span style="color: #0000DD; font-weight: bold">2</span>]));
}

<span style="color: #888888">// -----------------------------------------------------------------------------</span>

<span style="color: #008800; font-weight: bold">static</span> <span style="color: #333399; font-weight: bold">void</span> <span style="color: #0066BB; font-weight: bold">test_get_view_by_loc_location</span>()  {

    std<span style="color: #333333">::</span>cout <span style="color: #333333">&lt;&lt;</span> <span style="background-color: #fff0f0">&quot;</span><span style="color: #666666; font-weight: bold; background-color: #fff0f0">\n</span><span style="background-color: #fff0f0">Testing get_view_by_loc(locations) ...&quot;</span> <span style="color: #333333">&lt;&lt;</span> std<span style="color: #333333">::</span>endl;

    std<span style="color: #333333">::</span>vector<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">unsigned</span> <span style="color: #333399; font-weight: bold">long</span><span style="color: #333333">&gt;</span>  idx <span style="color: #333333">=</span> { <span style="color: #0000DD; font-weight: bold">123450</span>, <span style="color: #0000DD; font-weight: bold">123451</span>, <span style="color: #0000DD; font-weight: bold">123452</span>, <span style="color: #0000DD; font-weight: bold">123450</span>, <span style="color: #0000DD; font-weight: bold">123455</span>, <span style="color: #0000DD; font-weight: bold">123450</span>, <span style="color: #0000DD; font-weight: bold">123449</span> };
    std<span style="color: #333333">::</span>vector<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span> d1 <span style="color: #333333">=</span> { <span style="color: #0000DD; font-weight: bold">1</span>, <span style="color: #0000DD; font-weight: bold">2</span>, <span style="color: #0000DD; font-weight: bold">3</span>, <span style="color: #0000DD; font-weight: bold">4</span>, <span style="color: #0000DD; font-weight: bold">5</span>, <span style="color: #0000DD; font-weight: bold">6</span>, <span style="color: #0000DD; font-weight: bold">7</span> };
    std<span style="color: #333333">::</span>vector<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span> d2 <span style="color: #333333">=</span> { <span style="color: #0000DD; font-weight: bold">8</span>, <span style="color: #0000DD; font-weight: bold">9</span>, <span style="color: #0000DD; font-weight: bold">10</span>, <span style="color: #0000DD; font-weight: bold">11</span>, <span style="color: #0000DD; font-weight: bold">12</span>, <span style="color: #0000DD; font-weight: bold">13</span>, <span style="color: #0000DD; font-weight: bold">14</span> };
    std<span style="color: #333333">::</span>vector<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span> d3 <span style="color: #333333">=</span> { <span style="color: #0000DD; font-weight: bold">15</span>, <span style="color: #0000DD; font-weight: bold">16</span>, <span style="color: #0000DD; font-weight: bold">17</span>, <span style="color: #0000DD; font-weight: bold">18</span>, <span style="color: #0000DD; font-weight: bold">19</span>, <span style="color: #0000DD; font-weight: bold">20</span>, <span style="color: #0000DD; font-weight: bold">21</span> };
    std<span style="color: #333333">::</span>vector<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span> d4 <span style="color: #333333">=</span> { <span style="color: #0000DD; font-weight: bold">22</span>, <span style="color: #0000DD; font-weight: bold">23</span>, <span style="color: #0000DD; font-weight: bold">24</span>, <span style="color: #0000DD; font-weight: bold">25</span> };
    MyDataFrame         df;

    df.load_data(std<span style="color: #333333">::</span>move(idx),
                 std<span style="color: #333333">::</span>make_pair(<span style="background-color: #fff0f0">&quot;col_1&quot;</span>, d1),
                 std<span style="color: #333333">::</span>make_pair(<span style="background-color: #fff0f0">&quot;col_2&quot;</span>, d2),
                 std<span style="color: #333333">::</span>make_pair(<span style="background-color: #fff0f0">&quot;col_3&quot;</span>, d3),
                 std<span style="color: #333333">::</span>make_pair(<span style="background-color: #fff0f0">&quot;col_4&quot;</span>, d4));

    <span style="color: #008800; font-weight: bold">const</span> MyDataFrame   <span style="color: #333333">&amp;</span>const_df <span style="color: #333333">=</span> df;

    <span style="color: #008800; font-weight: bold">auto</span>    dfv1 <span style="color: #333333">=</span> df.get_view_by_loc<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(std<span style="color: #333333">::</span>vector<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">long</span><span style="color: #333333">&gt;</span> { <span style="color: #0000DD; font-weight: bold">3</span>, <span style="color: #0000DD; font-weight: bold">6</span> });
    <span style="color: #008800; font-weight: bold">auto</span>    dfv2 <span style="color: #333333">=</span> df.get_view_by_loc<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(std<span style="color: #333333">::</span>vector<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">long</span><span style="color: #333333">&gt;</span> { <span style="color: #333333">-</span><span style="color: #0000DD; font-weight: bold">4</span>, <span style="color: #333333">-</span><span style="color: #0000DD; font-weight: bold">1</span> , <span style="color: #0000DD; font-weight: bold">5</span> });
    <span style="color: #008800; font-weight: bold">auto</span>    const_dfv1 <span style="color: #333333">=</span> const_df.get_view_by_loc<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(std<span style="color: #333333">::</span>vector<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">long</span><span style="color: #333333">&gt;</span> { <span style="color: #0000DD; font-weight: bold">3</span>, <span style="color: #0000DD; font-weight: bold">6</span> });
    <span style="color: #008800; font-weight: bold">auto</span>    const_dfv2 <span style="color: #333333">=</span> const_df.get_view_by_loc<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(std<span style="color: #333333">::</span>vector<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">long</span><span style="color: #333333">&gt;</span> { <span style="color: #333333">-</span><span style="color: #0000DD; font-weight: bold">4</span>, <span style="color: #333333">-</span><span style="color: #0000DD; font-weight: bold">1</span> , <span style="color: #0000DD; font-weight: bold">5</span> });

    assert(dfv1.get_index().size() <span style="color: #333333">==</span> <span style="color: #0000DD; font-weight: bold">2</span>);
    assert(dfv1.get_column<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(<span style="background-color: #fff0f0">&quot;col_3&quot;</span>).size() <span style="color: #333333">==</span> <span style="color: #0000DD; font-weight: bold">2</span>);
    assert(dfv1.get_column<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(<span style="background-color: #fff0f0">&quot;col_2&quot;</span>).size() <span style="color: #333333">==</span> <span style="color: #0000DD; font-weight: bold">2</span>);
    assert(dfv1.get_index()[<span style="color: #0000DD; font-weight: bold">0</span>] <span style="color: #333333">==</span> <span style="color: #0000DD; font-weight: bold">123450</span>);
    assert(dfv1.get_index()[<span style="color: #0000DD; font-weight: bold">1</span>] <span style="color: #333333">==</span> <span style="color: #0000DD; font-weight: bold">123449</span>);
    assert(dfv1.get_column<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(<span style="background-color: #fff0f0">&quot;col_3&quot;</span>)[<span style="color: #0000DD; font-weight: bold">0</span>] <span style="color: #333333">==</span> <span style="color: #6600EE; font-weight: bold">18.0</span>);
    assert(dfv1.get_column<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(<span style="background-color: #fff0f0">&quot;col_2&quot;</span>)[<span style="color: #0000DD; font-weight: bold">1</span>] <span style="color: #333333">==</span> <span style="color: #6600EE; font-weight: bold">14.0</span>);
    assert(std<span style="color: #333333">::</span>isnan(dfv1.get_column<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(<span style="background-color: #fff0f0">&quot;col_4&quot;</span>)[<span style="color: #0000DD; font-weight: bold">1</span>]));

    assert(const_dfv1.get_index().size() <span style="color: #333333">==</span> <span style="color: #0000DD; font-weight: bold">2</span>);
    assert(const_dfv1.get_column<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(<span style="background-color: #fff0f0">&quot;col_3&quot;</span>).size() <span style="color: #333333">==</span> <span style="color: #0000DD; font-weight: bold">2</span>);
    assert(const_dfv1.get_column<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(<span style="background-color: #fff0f0">&quot;col_2&quot;</span>).size() <span style="color: #333333">==</span> <span style="color: #0000DD; font-weight: bold">2</span>);
    assert(const_dfv1.get_index()[<span style="color: #0000DD; font-weight: bold">0</span>] <span style="color: #333333">==</span> <span style="color: #0000DD; font-weight: bold">123450</span>);
    assert(const_dfv1.get_index()[<span style="color: #0000DD; font-weight: bold">1</span>] <span style="color: #333333">==</span> <span style="color: #0000DD; font-weight: bold">123449</span>);
    assert(const_dfv1.get_column<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(<span style="background-color: #fff0f0">&quot;col_3&quot;</span>)[<span style="color: #0000DD; font-weight: bold">0</span>] <span style="color: #333333">==</span> <span style="color: #6600EE; font-weight: bold">18.0</span>);
    assert(const_dfv1.get_column<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(<span style="background-color: #fff0f0">&quot;col_2&quot;</span>)[<span style="color: #0000DD; font-weight: bold">1</span>] <span style="color: #333333">==</span> <span style="color: #6600EE; font-weight: bold">14.0</span>);
    assert(std<span style="color: #333333">::</span>isnan(const_dfv1.get_column<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(<span style="background-color: #fff0f0">&quot;col_4&quot;</span>)[<span style="color: #0000DD; font-weight: bold">1</span>]));

    assert(dfv2.get_index().size() <span style="color: #333333">==</span> <span style="color: #0000DD; font-weight: bold">3</span>);
    assert(dfv2.get_column<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(<span style="background-color: #fff0f0">&quot;col_3&quot;</span>).size() <span style="color: #333333">==</span> <span style="color: #0000DD; font-weight: bold">3</span>);
    assert(dfv2.get_column<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(<span style="background-color: #fff0f0">&quot;col_2&quot;</span>).size() <span style="color: #333333">==</span> <span style="color: #0000DD; font-weight: bold">3</span>);
    assert(dfv2.get_column<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(<span style="background-color: #fff0f0">&quot;col_1&quot;</span>).size() <span style="color: #333333">==</span> <span style="color: #0000DD; font-weight: bold">3</span>);
    assert(dfv2.get_index()[<span style="color: #0000DD; font-weight: bold">0</span>] <span style="color: #333333">==</span> <span style="color: #0000DD; font-weight: bold">123450</span>);
    assert(dfv2.get_index()[<span style="color: #0000DD; font-weight: bold">1</span>] <span style="color: #333333">==</span> <span style="color: #0000DD; font-weight: bold">123449</span>);
    assert(dfv2.get_index()[<span style="color: #0000DD; font-weight: bold">2</span>] <span style="color: #333333">==</span> <span style="color: #0000DD; font-weight: bold">123450</span>);
    assert(dfv2.get_column<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(<span style="background-color: #fff0f0">&quot;col_1&quot;</span>)[<span style="color: #0000DD; font-weight: bold">0</span>] <span style="color: #333333">==</span> <span style="color: #6600EE; font-weight: bold">4.0</span>);
    assert(dfv2.get_column<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(<span style="background-color: #fff0f0">&quot;col_2&quot;</span>)[<span style="color: #0000DD; font-weight: bold">2</span>] <span style="color: #333333">==</span> <span style="color: #6600EE; font-weight: bold">13.0</span>);
    assert(dfv2.get_column<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(<span style="background-color: #fff0f0">&quot;col_4&quot;</span>)[<span style="color: #0000DD; font-weight: bold">0</span>] <span style="color: #333333">==</span> <span style="color: #6600EE; font-weight: bold">25.0</span>);
    assert(std<span style="color: #333333">::</span>isnan(dfv2.get_column<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(<span style="background-color: #fff0f0">&quot;col_4&quot;</span>)[<span style="color: #0000DD; font-weight: bold">1</span>]));
    assert(std<span style="color: #333333">::</span>isnan(dfv2.get_column<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(<span style="background-color: #fff0f0">&quot;col_4&quot;</span>)[<span style="color: #0000DD; font-weight: bold">2</span>]));

    assert(const_dfv2.get_index().size() <span style="color: #333333">==</span> <span style="color: #0000DD; font-weight: bold">3</span>);
    assert(const_dfv2.get_column<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(<span style="background-color: #fff0f0">&quot;col_3&quot;</span>).size() <span style="color: #333333">==</span> <span style="color: #0000DD; font-weight: bold">3</span>);
    assert(const_dfv2.get_column<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(<span style="background-color: #fff0f0">&quot;col_2&quot;</span>).size() <span style="color: #333333">==</span> <span style="color: #0000DD; font-weight: bold">3</span>);
    assert(const_dfv2.get_column<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(<span style="background-color: #fff0f0">&quot;col_1&quot;</span>).size() <span style="color: #333333">==</span> <span style="color: #0000DD; font-weight: bold">3</span>);
    assert(const_dfv2.get_index()[<span style="color: #0000DD; font-weight: bold">0</span>] <span style="color: #333333">==</span> <span style="color: #0000DD; font-weight: bold">123450</span>);
    assert(const_dfv2.get_index()[<span style="color: #0000DD; font-weight: bold">1</span>] <span style="color: #333333">==</span> <span style="color: #0000DD; font-weight: bold">123449</span>);
    assert(const_dfv2.get_index()[<span style="color: #0000DD; font-weight: bold">2</span>] <span style="color: #333333">==</span> <span style="color: #0000DD; font-weight: bold">123450</span>);
    assert(const_dfv2.get_column<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(<span style="background-color: #fff0f0">&quot;col_1&quot;</span>)[<span style="color: #0000DD; font-weight: bold">0</span>] <span style="color: #333333">==</span> <span style="color: #6600EE; font-weight: bold">4.0</span>);
    assert(const_dfv2.get_column<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(<span style="background-color: #fff0f0">&quot;col_2&quot;</span>)[<span style="color: #0000DD; font-weight: bold">2</span>] <span style="color: #333333">==</span> <span style="color: #6600EE; font-weight: bold">13.0</span>);
    assert(const_dfv2.get_column<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(<span style="background-color: #fff0f0">&quot;col_4&quot;</span>)[<span style="color: #0000DD; font-weight: bold">0</span>] <span style="color: #333333">==</span> <span style="color: #6600EE; font-weight: bold">25.0</span>);
    assert(std<span style="color: #333333">::</span>isnan(const_dfv2.get_column<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(<span style="background-color: #fff0f0">&quot;col_4&quot;</span>)[<span style="color: #0000DD; font-weight: bold">1</span>]));
    assert(std<span style="color: #333333">::</span>isnan(const_dfv2.get_column<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(<span style="background-color: #fff0f0">&quot;col_4&quot;</span>)[<span style="color: #0000DD; font-weight: bold">2</span>]));

    dfv2.get_column<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(<span style="background-color: #fff0f0">&quot;col_1&quot;</span>)[<span style="color: #0000DD; font-weight: bold">0</span>] <span style="color: #333333">=</span> <span style="color: #6600EE; font-weight: bold">101.0</span>;
    assert(dfv2.get_column<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(<span style="background-color: #fff0f0">&quot;col_1&quot;</span>)[<span style="color: #0000DD; font-weight: bold">0</span>] <span style="color: #333333">==</span> <span style="color: #6600EE; font-weight: bold">101.0</span>);
    assert(const_dfv2.get_column<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(<span style="background-color: #fff0f0">&quot;col_1&quot;</span>)[<span style="color: #0000DD; font-weight: bold">0</span>] <span style="color: #333333">==</span> <span style="color: #6600EE; font-weight: bold">101.0</span>);
    assert(df.get_column<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(<span style="background-color: #fff0f0">&quot;col_1&quot;</span>)[<span style="color: #0000DD; font-weight: bold">3</span>] <span style="color: #333333">==</span> <span style="color: #6600EE; font-weight: bold">101.0</span>);

    <span style="color: #008800; font-weight: bold">auto</span>  memory_use <span style="color: #333333">=</span> dfv2.get_memory_usage<span style="color: #333333">&lt;</span><span style="color: #333399; font-weight: bold">double</span><span style="color: #333333">&gt;</span>(<span style="background-color: #fff0f0">&quot;col_3&quot;</span>);

    std<span style="color: #333333">::</span>cout <span style="color: #333333">&lt;&lt;</span> <span style="background-color: #fff0f0">&quot;View Memory Usage:</span><span style="color: #666666; font-weight: bold; background-color: #fff0f0">\n</span><span style="background-color: #fff0f0">&quot;</span> <span style="color: #333333">&lt;&lt;</span> memory_use <span style="color: #333333">&lt;&lt;</span> std<span style="color: #333333">::</span>endl;
}
</pre></div>

  <img src="https://github.com/hosseinmoein/DataFrame/blob/master/docs/LionLookingUp.jpg?raw=true" alt="C++ DataFrame"
       width="200" height="150" style="float:right"/>

</body>
</html>

<!--
Local Variables:
mode:HTML
tab-width:4
c-basic-offset:4
End:
-->
